﻿@model IEnumerable<YogaStudio.Data.Domain.ShoppingCart>

@{
    ViewBag.Title = "Index";
}

<div class="main">
    <div class="content">
        <div class="section group">
            <div class="col span_2_of_3">
                <div class="contact-form">
                    <p>
                        @if (TempData["Message"] != null)
                        {
                            <div style="color:green;" id="successMessage">@TempData["Message"]</div>
                            <script>
                                setInterval(function () {
                                    $("#successMessage").fadeOut("slow");
                                }, 1500);
                            </script>
                        }
                    </p>
                    <h3>Shopping Cart Items</h3>
                    <table class="details">
                        <tr>
                            <td>
                                Product Name
                            </td>
                            <td>
                                Price
                            </td>
                            <td>
                                Quantity
                            </td>
                            <td>
                                Total
                            </td>
                            <td></td>
                            <td></td>
                        </tr>
                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>
                                    @item.Product.ProductName
                                </td>
                                <td>
                                    @string.Format("{0:C}", item.Product.Price)
                                </td>
                                <td>
                                    @string.Format("{0}", item.Quantity)
                                </td>

                                <td>
                                    @string.Format("{0:C}", (item.Quantity * item.Product.Price))
                                </td>
                                <td>
                                    <img src="@Url.Content(item.Product.ImageUrl ?? "~/Content/Images/DefaultPicture.jpeg")" alt="Image Not Found" height="25" width="40" />
                                </td>
                                <td>
                                    @using(Html.BeginForm("RemoveItemFromCart", "ShoppingCart"))
                                    {
                                        @Html.Hidden("id", item.RecordId)
                                        <input type="submit" value="Remove" class="btn btn-default" />
                                    }
                                </td>
                            </tr>
                        }
                        <tr>
                            <td></td>
                            <td></td>
                            <td>@ViewBag.TotalCartItems</td>
                            <td>@string.Format("{0:C}", @ViewBag.TotalCartPrice)</td>
                            <td></td>
                            <td></td>
                        </tr>
                    </table>
                </div>
                <p>
                    @if (Model.Any())
                    {
                        @Html.ActionLink("Check Out", "BillingAndPayment", "CheckOut", null, new { @class = "btn", @id = "bluebck" })
                    }
                </p>
            </div>
        </div>
    </div>
</div>
<br />

<br />
<br />
